/* 人工智能互动科普库 - 针对1280x800屏幕优化 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    overflow-x: hidden;
}

h1 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    margin: 2rem 0 3rem 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

.bookshelf {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.shelf-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    padding: 1rem 0;
    justify-items: center;
    margin-bottom: 2rem;
}

.book {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px 8px 15px 15px;
    padding: 1.5rem 1rem;
    box-shadow: 
        0 8px 25px rgba(0,0,0,0.15),
        0 2px 8px rgba(0,0,0,0.1),
        inset 0 1px 0 rgba(255,255,255,0.8);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 200px;
    min-height: 180px;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
}

.book-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: inherit;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    padding: 1.5rem 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 200px;
    min-height: 180px;
    position: relative;
    overflow: hidden;
    border: 2px dashed rgba(0,0,0,0.2);
}

/* 书脊效果 */
.book::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, 
        rgba(0,0,0,0.3) 0%, 
        rgba(0,0,0,0.1) 50%, 
        rgba(0,0,0,0.2) 100%);
    border-radius: 2px 0 0 2px;
    z-index: 1;
}

/* 书页效果 */
.book::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.8) 0%, 
        rgba(255,255,255,0.4) 50%, 
        rgba(255,255,255,0.6) 100%);
    border-radius: 0 2px 2px 0;
    z-index: 1;
}

.book:hover {
    transform: translateY(-8px) rotateY(-5deg) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0,0,0,0.25),
        0 5px 15px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.9);
}

.book:hover::before {
    background: linear-gradient(180deg, 
        rgba(0,0,0,0.4) 0%, 
        rgba(0,0,0,0.2) 50%, 
        rgba(0,0,0,0.3) 100%);
}

.book:hover::after {
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.9) 0%, 
        rgba(255,255,255,0.5) 50%, 
        rgba(255,255,255,0.7) 100%);
}

.book-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.book:hover .book-icon {
    transform: scale(1.1) rotateZ(-2deg);
}

.book-title {
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    color: #2c3e50;
    line-height: 1.3;
    position: relative;
    z-index: 2;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin-top: 0.5rem;
}

.book-placeholder .book-icon {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    opacity: 0.6;
}

.book-placeholder .book-title {
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    color: #666;
    line-height: 1.3;
}

/* 特定书籍样式 - 模拟真实书籍封面 */
.book.solar-power {
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    border-left: 6px solid #ff6b35;
}

.book.world-map {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-left: 6px solid #00b894;
}

.book.turbofan {
    background: linear-gradient(135deg, #d299c2 0%, #fef9d7 100%);
    border-left: 6px solid #6c5ce7;
}

.book.hannault {
    background: linear-gradient(135deg, #89f7fe 0%, #66a6ff 100%);
    border-left: 6px solid #0984e3;
}

.book.fossil {
    background: linear-gradient(135deg, #fdbb2d 0%, #22c1c3 100%);
    border-left: 6px solid #e17055;
}

.book.rock {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-left: 6px solid #e84393;
}

.book.mineral {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 100%);
    border-left: 6px solid #a29bfe;
}

.book.lightning {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-left: 6px solid #fdcb6e;
}

.book.radiometer {
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    border-left: 6px solid #74b9ff;
}

.book.manipulator {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
    border-left: 6px solid #fd79a8;
}

.book.piano {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    border-left: 6px solid #fdcb6e;
}

.book.ai {
    background: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 100%);
    border-left: 6px solid #6c5ce7;
}

.book.wheat {
    background: linear-gradient(135deg, #00b894 0%, #00cec9 100%);
    border-left: 6px solid #00b894;
}

.book.soil {
    background: linear-gradient(135deg, #8b4513 0%, #cd853f 100%);
    border-left: 6px solid #8b4513;
}

.book.silkworm {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-left: 6px solid #f39c12;
}

.book.dragonfly {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border-left: 6px solid #2ecc71;
}

.book.foodcrops {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
    border-left: 6px solid #f1c40f;
}

.book.arthropods {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-left: 6px solid #e74c3c;
}

.book.beansprouts {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
    border-left: 6px solid #1abc9c;
}

/* 响应式设计 - 针对1280x800优化 */
@media screen and (max-width: 1280px) {
    .shelf-row {
        gap: 1.5rem;
    }
    
    .book, .book-placeholder {
        max-width: 180px;
        min-height: 150px;
        padding: 1.2rem 0.8rem;
    }
    
    h1 {
        font-size: 2.2rem;
        margin: 1.5rem 0 2rem 0;
    }
}

@media screen and (max-width: 1024px) {
    .shelf-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.2rem;
    }
    
    .book, .book-placeholder {
        max-width: 160px;
        min-height: 140px;
        padding: 1rem 0.6rem;
    }
    
    .book-icon {
        font-size: 2.2rem;
    }
    
    .book-title {
        font-size: 0.9rem;
    }
    
    h1 {
        font-size: 2rem;
        margin: 1rem 0 1.5rem 0;
    }
}

@media screen and (max-width: 768px) {
    .bookshelf {
        padding: 0 1rem;
    }
    
    .shelf-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .book, .book-placeholder {
        max-width: 140px;
        min-height: 130px;
        padding: 0.8rem 0.5rem;
    }
    
    .book-icon {
        font-size: 2rem;
        margin-bottom: 0.6rem;
    }
    
    .book-title {
        font-size: 0.85rem;
    }
    
    h1 {
        font-size: 1.8rem;
        margin: 1rem 0 1.2rem 0;
    }
}

/* 横屏模式优化 (1280x800) */
@media screen and (orientation: landscape) and (max-height: 800px) {
    h1 {
        font-size: 2rem;
        margin: 1rem 0 1.2rem 0;
    }
    
    .shelf-row {
        gap: 1.2rem;
        padding: 0.8rem 0;
        margin-bottom: 1.5rem;
    }
    
    .book, .book-placeholder {
        max-width: 180px;
        min-height: 130px;
        padding: 1rem 0.6rem;
    }
    
    .book-icon {
        font-size: 2.2rem;
        margin-bottom: 0.6rem;
    }
    
    .book-title {
        font-size: 0.9rem;
    }
}

/* 翻书动画 */
@keyframes bookFlip {
    0% {
        transform: translateY(0) rotateY(0deg) scale(1);
        box-shadow: 
            0 8px 25px rgba(0,0,0,0.15),
            0 2px 8px rgba(0,0,0,0.1),
            inset 0 1px 0 rgba(255,255,255,0.8);
    }
    50% {
        transform: translateY(-30px) rotateY(-30deg) scale(1.2);
        box-shadow: 
            0 25px 50px rgba(0,0,0,0.3),
            0 10px 25px rgba(0,0,0,0.2),
            inset 0 1px 0 rgba(255,255,255,0.95);
    }
    100% {
        transform: translateY(-50px) rotateY(-60deg) scale(1.5);
        box-shadow: 
            0 50px 100px rgba(0,0,0,0.5),
            0 25px 50px rgba(0,0,0,0.3),
            inset 0 1px 0 rgba(255,255,255,1);
        opacity: 0.8;
    }
}

/* 翻书动画类 */
.book-opening {
    animation: bookFlip 0.8s ease-in-out forwards;
    pointer-events: none;
    z-index: 1000;
}

/* 页面淡出效果 */
@keyframes pageFadeOut {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0.3;
        transform: scale(0.95);
    }
}

/* 当有书籍在翻页时，其他书籍淡出 */
.bookshelf:has(.book-opening) .book:not(.book-opening) {
    animation: pageFadeOut 0.8s ease-in-out forwards;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book {
    animation: fadeInUp 0.6s ease forwards;
}

/* 动画延迟 - 5行布局 */
.shelf-row:nth-child(1) .book:nth-child(1) { animation-delay: 0.1s; }
.shelf-row:nth-child(1) .book:nth-child(2) { animation-delay: 0.2s; }
.shelf-row:nth-child(1) .book:nth-child(3) { animation-delay: 0.3s; }
.shelf-row:nth-child(1) .book:nth-child(4) { animation-delay: 0.4s; }

.shelf-row:nth-child(2) .book:nth-child(1) { animation-delay: 0.5s; }
.shelf-row:nth-child(2) .book:nth-child(2) { animation-delay: 0.6s; }
.shelf-row:nth-child(2) .book:nth-child(3) { animation-delay: 0.7s; }
.shelf-row:nth-child(2) .book:nth-child(4) { animation-delay: 0.8s; }

.shelf-row:nth-child(3) .book:nth-child(1) { animation-delay: 0.9s; }
.shelf-row:nth-child(3) .book:nth-child(2) { animation-delay: 1.0s; }
.shelf-row:nth-child(3) .book:nth-child(3) { animation-delay: 1.1s; }
.shelf-row:nth-child(3) .book:nth-child(4) { animation-delay: 1.2s; }

.shelf-row:nth-child(4) .book:nth-child(1) { animation-delay: 1.3s; }
.shelf-row:nth-child(4) .book:nth-child(2) { animation-delay: 1.4s; }
.shelf-row:nth-child(4) .book:nth-child(3) { animation-delay: 1.5s; }
.shelf-row:nth-child(4) .book:nth-child(4) { animation-delay: 1.6s; }

.shelf-row:nth-child(5) .book:nth-child(1) { animation-delay: 1.7s; }
.shelf-row:nth-child(5) .book:nth-child(2) { animation-delay: 1.8s; }
.shelf-row:nth-child(5) .book:nth-child(3) { animation-delay: 1.9s; }
.shelf-row:nth-child(5) .book-placeholder { animation-delay: 2.0s; }

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.5);
}
